<?php
	define('DATABASE','dealscombined');
	require '/var/www/sandbox/dealscombined.co.uk/scripts/connect.php';
	$file = "unmappedProducts.json";
	
	
	// Select DB
	$db=mysql_select_db(DATABASE,$connect);
	if(!$db) {
		die('Can\'t use DATABASE : '.mysql_error());
	}
	
	$result = mysql_query("SELECT * FROM unmapped_products");
	
	$unmappedProducts = array();
	
	while($row = mysql_fetch_assoc($result)){
		
		$unmappedProducts[$row['product_id']] = '/^'.preg_quote($row['title']).'$/';
	}
	
	file_put_contents($file, json_encode($unmappedProducts));
?>